public class Main3 {
    public static void main(String[] args) {
        int[] array = {1, 2, 3, 4, 5, 6};
        int[] temp = new int[array.length - 2];
        temp = delete(array);
        for (int element : temp) {
            System.out.print(element + " ");
        }
    }

    //编写代码，删除掉⼀个元素个数为偶数的整数数组的中间元素（提示：数组元素个数是偶数，要删除中间两个元素）
    public static int[] delete(int[] arr) {
        int len = arr.length / 2;
        int[] num = new int[arr.length - 2];
        for (int i = 0; i < arr.length - 2; i++) {
            if (i < len - 1) {
                num[i] = arr[i];
            } else {
                num[i] = arr[i + 2];
            }
        }
        return num;
    }
}
